/**
 * 云南
 */
(function() {
	'use strict';
	require(['orange','echarts'], function(orange,echarts) {
		var w = Math.floor(document.body.clientWidth*0.5)-5;
		$('#yn_map_chart').css({'width':w,'height':w});
		//JSON
	    $.getJSON('resources/json/yunnan2.json', function (ynData) {
	        echarts.registerMap('yn', ynData);
	        var myChart = echarts.init(document.getElementById('yn_map_chart'));
	        var data = [
			            {name: '曲靖', value: 27,doctor:32},
			            {name: '玉溪', value: 31,doctor:32},
			            {name: '昆明', value: 93,doctor:32},
			            {name: '丽江', value: 32,doctor:32},
			            {name: '临沧', value: 87,doctor:32},
			            {name: '昭通', value: 35,doctor:32},
			            {name: '普洱', value: 58,doctor:32},
			            {name: '保山', value: 67,doctor:32},
			            {name: '大理', value: 38,doctor:32},
			            {name: '楚雄', value: 39,doctor:32},
			            {name: '文山', value: 32,doctor:32},
			            {name: '德宏', value: 33,doctor:32},
			            {name: '迪庆', value: 34,doctor:32},
			            {name: '红河', value: 65,doctor:32},
			            {name: '西双版纳', value: 76,doctor:32},
			            {name: '怒江', value: 86,doctor:32}
			       ];
			       var option = {
			           tooltip : {
			               trigger: 'item',
			               formatter: function(item){
			            	   var itemData = item.data;
			            	   return itemData.name+'<br/>中医馆：'+itemData.value+' (家)<br/>医生数量：'+itemData.doctor+' (个)';
			               }
			           },
			           visualMap: {
				            min: 0,
				            max: 100,
				            text:['高','低'],
				            realtime: false,
				            calculable: true,
				            inRange: {
				            	color: ['yellow', 'orange'],
				            },
				            right:'4%',
				            align:'left',
				            bottom:'6%',
				            textStyle:{
				                color:'#fff',
				                fontSize:20
				            }
				        },
				        series: [{
		                     name: '云南数据',
		                     type: 'map',
		                     mapType: 'yn', // 自定义扩展图表类型
		                     zoom:1.1,
		                     roam:true,
		                     selectedMode:'single',
		                     itemStyle:{
		                    	 normal:{
									   label:{
								           show:false
								       },
								   areaStyle:{
								       color: '#1b1b1b'
								       }
								   },
									emphasis:{
										label:{ 
											show:true
										},
										areaColor:'rgba(194,53,49,0.7)'
									}
			                   },
			                   label:{
			                	   emphasis:{
			                		   show:false
			                	   }
			                   },
		                       data:data
		                }]
			       };                                
			       
	        // 使用刚指定的配置项和数据显示图表。
			$('#tcm_ynMap_div').data('ynMapOption', option);
	        myChart.setOption(option);
	        $('#tcm_ynMap_div').data('ynMapChart', myChart);
	    });   
	});
})();